{{ define "term/index.html" }}
{{ template "term/header.html" . }}
<a href="/term/create" class="btn btn-primary float-end">
    <i class="bi bi-plus-circle"></i>
    新增终端
</a>

<table class="table">
    <thead>
    <tr>
        <th scope="col">SIM</th>
        <th scope="col">状态</th>
        <th scope="col">经纬度</th>
        <th scope="col">定位时间</th>
        <th scope="col">操作</th>
    </tr>
    </thead>
    <tbody>
    {{ range .Terms }}
    <tr>
        <th scope="row">{{ .SIM }}</th>
        <td>
            {{ if .Status }}
            <span class="badge bg-success">在线</span>
            {{ else }}
            <span class="badge bg-danger">离线</span>
            {{ end }}
        </td>
        <td>{{ .Lng }}, {{ .Lat }}</td>
        <td>{{ .LocateAt | formatAsTime }}</td>
        <td>
            <a href="/term/edit/{{ .SIM }}" class="btn btn-primary btn-sm">
                <i class="bi bi-pencil-square"></i>
            </a>
            <a href="/term/del/{{ .SIM }}" class="btn btn-danger btn-sm" onclick="return confirm('确定要删除该项数据吗？')">
                <i class="bi bi-trash-fill"></i>
            </a>
        </td>
    </tr>
    {{ end }}
    </tbody>
</table>
{{ template "term/footer.html" . }}
{{ end }}